package com.aplicacion.apna;
 
import java.io.FileDescriptor;

import android.app.Activity;
import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
 
public class Item extends Activity{
	
	private VideoView videoView;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.item_view);
                  
        Intent i = getIntent();
        String palabra = i.getStringExtra("palabra"); 
        String tematica = i.getStringExtra("tematica");    
        setTitle(palabra);
                
        
        videoView =(VideoView)findViewById(R.id.videoView1);       
   
        Uri uri = Uri.parse("android.resource://com.aplicacion.apna/raw/"+tematica+ "_"+palabra.toLowerCase()); 
        videoView.setVideoURI(uri);
        		
        videoView.setMediaController(new MediaController(this));
        videoView.start();
        videoView.requestFocus();
         
        videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            public void onCompletion(MediaPlayer mp) {
                finish(); 
            }           
        });       
    }   
}